import numpy as np
import matplotlib.pyplot as plt
from PIL import Image


def show_pic():
    img = Image.open("")

    gary = img.convert("L")
    gary_array = np.array(gary)
    plt.imshow(gary)
    plt.show()


def convert_numpy_array():
    list_1 = [5, 6.5, 9, 2, 3, 7.8, 5.6, 4.9]
    np_array = np.array(list_1)
    print(list_1)
    print(np_array)
    print(np_array.dtype)


def d2_array():
    list_2 = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]
    arr2 = np.array(list_2)
    print(list_2)
    print(arr2)


def zeros_matrix():
    matrix = np.zeros((5, 6))
    print(matrix.shape)


def ones_matrix():
    matrix = np.ones((5, 6))
    print(matrix.shape)


def eye_matrix():
    matrix = np.eye(5)
    print(matrix.shape)


def range_demo():
    for i in range(10):
        print(1)


def arrange_demo():
    arr = np.arange(1, 10, 2)
    for i in arr:
        print(i)


def plot_demo():
    x = np.arange()

    np.random.seed(500)

    y = np.random.randint(20, size=(10,))
    plt.plot(x, y, 'b', lw=3)
    plt.plot(x)
    plt.plot(y)
    plt.show()


def bar_demo():
    # 为了显示中文，指定默认字体，否者中文为乱码
    plt.rcParams['font.sans-serif'] = ['SimHei']
    # 图1
    # 设置刻度字体大小
    plt.xlabel("日期")
    plt.ylabel("票房")
    plt.title("xx电影票房纪录")
    x = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
    y = [1000, 1500, 2000, 2500, 3000, 3500, 4000]

    path = ""

# 继承
class Car:
    def __init__(self, name, color):
        self.name = name
        self.color = color

        print("现身吧!奥兹!")

    def go(self):
        print(self.name, "做好觉悟吧,本皇女将降下那屏断昼夜的圣裁之累!")


class Fly:
    def __init__(self, name, high):
        self.name = name
        self.high = high

    def get_high(self):
        return self.high

    def fly(self):
        print("我是", self.name, "我的夜鸦眷属能够飞到", self.high, "的高空")


class NewFlyCar(Car, Fly):
    def __init__(self, name, color, high):
        Car.__init__(self, name, color)
        Fly.__init__(self, name, high)


class FlyCar(Car):
    def __init__(self, name, color, high):
        Car.__init__(self, name, color)
        self.high = high

    def get_high(self):
        return self.high

    def fly(self):
        print("我是", self.name, "我的夜鸦眷属能够飞到", self.high, "的高空")


if __name__ == '__main__':
    print("你好! 履行者!")

    bydFly = FlyCar("断罪皇女!菲谢尔,乃幽夜净土的主宰之人!", "紫色", 100)
    bydFly.fly()
    bydFly.go()

    a_NewFlyCar = NewFlyCar("断罪皇女!菲谢尔,乃幽夜净土的主宰之人!", "紫色", 114514)
    a_NewFlyCar.go()
    a_NewFlyCar.fly()
